const {DataTypes} = require('sequelize')

const sequelize = require('../db/sequelize')

//创建模型  模型对应数据表
const Record = sequelize.define('Record', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        allowNull: false,
        autoIncrement: true,
        comment: 'id'
    },
    title: {
        type: DataTypes.STRING(1000),
        allowNull: true,
        comment: '标题'
    },
    context: {
        type: DataTypes.TEXT,
        allowNull: true,
        comment: '内容'
    },
    person: {
        type: DataTypes.INTEGER,
        allowNull: true,
        comment: '责任人'
    },
    state: {
        type: DataTypes.INTEGER,
        allowNull: true,
        comment: '状态 1新建,2待验证,3重新打开,4已解决,5未解决',
    },
}, {
    tableName: 'record',
    timestamps: true
})

//强制同步数据库（创建数据表）
Record.sync()

module.exports = Record